package com.datasecops.scannerservices.util;

import com.aliyun.oss.OSSClient;

/**
 * @author: GeXiaoLong
 * @time: 2022/11/7 16:17
 */
public class OssUtil {
    private static String ENDPOINT = "oss-cn-beijing.aliyuncs.com";//外网访问节点
    private static String ACCESSKEYID = "LTAI5tS1FnMowceqWBGjephM";//访问秘钥
    private static String ACCESSKEYSECRET = "ZfIlHuBb1nu7bhH33PQMzUEWJMQYfY";//加密签名字符串和OSS用来验证签名字符串的密钥
    private static String BUKETNAME = "soulmy"; //存储空间名称
    private static String SUFFER_URL = "http://soulmy.oss-cn-beijing.aliyuncs.com";//上传成功后返回的URL;

    public OSSClient getOSSClient() {
        //创建一个ossclient对象
        OSSClient ossClient = new OSSClient(ENDPOINT, ACCESSKEYID, ACCESSKEYSECRET);
        if (ossClient.doesBucketExist(BUKETNAME)){
            System.out.println("成功");
            ossClient.shutdown();
            return ossClient;
        }else{
            System.out.println("失败");
            ossClient.shutdown();
            return null;
        }

    }

    public static void main(String[] args) {
        OssUtil ossUtil = new OssUtil();
        ossUtil.getOSSClient();
    }

}
